﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Marmat.Template.WinForm
{
    /// <summary>
    /// 事件总线的接口标准
    /// </summary>
    public interface IEventBus
    {
        /// <summary>
        /// 订阅事件。
        /// </summary>
        ///<param name="channel">通道</param>
        ///<param name="handler">事件处理事件</param>
        void Subscribe<TEvent>(string channel, IEventHandler<TEvent> handler) where TEvent : IEventBase;

        /// <summary>
        /// 发布事件。
        /// </summary>
        ///<param name="channel">通道</param>
        ///<param name="body">事件参数</param>
        void Publish<TEvent>(string channel, TEvent body) where TEvent : IEventBase;

        /// <summary>
        /// 移除订阅的事件。
        /// </summary>
        /// <typeparam name="TEvent"></typeparam>
        /// <param name="handler"></param>
        void RemoveSubscription<TEvent>(IEventHandler<TEvent> handler) where TEvent : IEventBase;
    }
}
